﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace TaskBooker.Controls.Buttons
{
    /// <summary>
    /// Interaction logic for ButtonClose.xaml
    /// </summary>
    public partial class ButtonClose
    {
        public ButtonClose()
        {
            this.InitializeComponent();
        }

        private void buttonClose_Click(object sender, RoutedEventArgs e)
        {
            object parent = sender;

            while ((parent as Window) ==null)
            {
                //c.GetType().GetProperty( "Parent" );
                parent = ((FrameworkElement)parent).Parent;
            }
            ( parent as Window ).Close();
        }

        private void Path_MouseEnter(object sender, MouseEventArgs e)
        {
            ( ( Path )sender ).Fill = this.TryFindResource( "XBrush_onEnter" ) as Brush;//XBrush_onEnter;//"#FF2C2849"
        }

        private void Path_MouseLeave(object sender, MouseEventArgs e)
        {
            ( ( Path )sender ).Fill = this.TryFindResource( "XBrush_default" ) as Brush;
        }
    }
}